{extend name='public/base'}
{block name='content'}

    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        {$item['item1']}
        <small>{$item['item2']}</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> {$item['item1']}</a></li>
        <li class="active">{$item['item2']}</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">操作栏</h3>
        </div>
        <div class="panel-body">

              <button type="button" onclick="lotus_show('新增菜单',
                                    'show_add_menu.html',520,450)" class="btn btn-sm btn-success">新增权限
                                    </button>
            <!--   <button class="btn  btn-danger btn-small">删除</button> -->
        </div>
     </div>
     <div class="row">
        <div class="col-xs-12">
          <!-- /.box -->
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">列表</h3>
            </div>

            <!-- /.box-header -->
            <div class="box-body">
              <table id="example1" class="table table-bordered table-hover table-striped">
                <thead>

                <tr>
                  <th>ID</th>
                  <th>菜单名称</th>
                  <th>控制器</th>
                  <th>图标</th>
                  <th>状态</th>
                  <th>操作</th>
                </tr>

                </thead>
                <tbody>
                   {volist name='list' id='vo'}
                            <tr>
                                <td>{$vo.id}</td>
                                <td>&nbsp;{$vo.level-1|str_repeat='&nbsp;丨---',###}{$vo.title}</td>
                                <td>{$vo.name}</td>
                                <td>
                                    <?php
                                        if(empty($vo['icon'])){
                                        echo '未设置';
                                    }else{
                                         echo $vo['icon'];
                                    }
                                    ?>
                                </td>

                                <td>
                                  {php}
                                    if($vo['level']<3){
                                        if($vo['status']==1){
                                            echo '<font color="blue">显示</font>';
                                        }else{
                                            echo '<font color="red">隐藏</font>';
                                        }
                                    }else{
                                            echo "<font color='red'>
                                                <a href='javascript:layer.alert(".'"不参与菜单显示,仅作为系统函数方法控制"'.");'>节点</a>
                                               </font>";
                                    }
                                  {/php}
                                </td>

                                <td>
                                  <!--<button type="button" class="btn btn-success">添加子菜单</button> <button type="button" class="btn btn-primary">编辑</button> <button type="button" class="btn btn-danger" onClick="delcfm('{:url(\'admin/menu/del\',[\'id\' => $vo[\'id\']])}','{$vo.title}')">删除</button>-->
                                    <button type="button" onclick="lotus_show('编辑菜单',
                                    'show_edit_menu.html?id={$vo.id}',500,460)" class="btn btn-xs btn-success">编辑
                                    </button>
                                    <button type="button" onClick="deleteAuthRule({$vo.id})" class="btn  btn-danger btn-xs">删除</button>
                                </td>
                            </tr>
                            {/volist}
                </tbody>

                <!--    <tfoot>
                       <tr>
                        <th>Rendering engine</th>
                        <th>Browser</th>
                        <th>Platform(s)</th>
                        <th>Engine version</th>
                        <th>CSS grade</th>
                     </tr>
                </tfoot> -->


              </table>

            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->

{/block}
{block name='js'}
  <script type="text/javascript">
      function deleteAuthRule(id){
                 layer.confirm('确定要删除吗?',{
                    btn: ['确定','取消'] //按钮
                  }, function(){
                      $.ajax({
                          url: 'deleteAuthRule',
                          type: 'get',
                          dataType: 'json',
                          data: {id:id},
                      })
                      .done(function(data){
                          console.log(data);
                          if(data.code==0){
                              layer.msg(data.msg,{icon:5,time:500});
                          }else{
                              layer.msg(data.msg,{icon:1,time:500},function(){
                                  location.reload();
                              })
                          }
                      })
                  });
      }
  </script>
{/block}